var http = require('http');
var url = require('url');

function start(route) {
	function onReq(req, resp) {
		var path = url.parse(req.url).pathname;
		console.log('request ->', path);
		route(path);
		resp.writeHead(200, {'content-type':'text/plain'});
		resp.write('hello world');
		resp.end();
	}
	http.createServer(onReq).listen(8080);
	console.log('server started');
}

exports.start = start;
